import * as cecharts from 'echarts/core'
import {
  BarChart,
  BarSeriesOption,
  LineChart,
  LineSeriesOption,
  MapChart,
  MapSeriesOption,
  EffectScatterChart,
  EffectScatterSeriesOption,
  PictorialBarChart,
  PictorialBarSeriesOption,
  PieChart,
  PieSeriesOption
} from 'echarts/charts' // 系列类型的定义后缀都为 SeriesOption
import {
  TooltipComponent,
  TooltipComponentOption,
  GridComponent,
  GridComponentOption,
  GeoComponent,
  GeoComponentOption,
  LegendComponent,
  LegendComponentOption,
  DataZoomComponent,
  DataZoomComponentOption
} from 'echarts/components' // echarts组件

/**解决图形变换 */
import {CanvasRenderer} from 'echarts/renderers'

// 通过 ComposeOption 来组合出一个只有必须组件和图表的 Option 类型
export type ECOption = cecharts.ComposeOption<
  | BarSeriesOption
  | LineSeriesOption
  | TooltipComponentOption
  | GridComponentOption
  | MapSeriesOption
  | GeoComponentOption
  | EffectScatterSeriesOption
  | PictorialBarSeriesOption
  | LegendComponentOption
  | PieSeriesOption
  | DataZoomComponentOption
>
// 注册必须的组件
cecharts.use([
  BarChart,
  EffectScatterChart,
  LineChart,
  MapChart,
  PictorialBarChart,
  PieChart,

  DataZoomComponent,
  GridComponent,
  GeoComponent,
  LegendComponent,
  TooltipComponent,

  CanvasRenderer
])

console.log(cecharts)

export default cecharts
